{% extends "base.html" %}

{% block title %}删除任务 - 在线跑批系统{% endblock %}

{% block content %}
<div class="row justify-content-center">
    <div class="col-md-6">
        <div class="card border-danger">
            <div class="card-header bg-danger text-white">
                <h4 class="mb-0"><i class="fas fa-exclamation-triangle me-2"></i>确认删除</h4>
            </div>
            <div class="card-body">
                <h5 class="card-title">您确定要删除任务 <span class="text-danger">{{ task.name }}</span> 吗？</h5>
                <p class="text-warning">警告：此操作将删除任务的所有信息，包括关联的执行日志。此操作不可恢复！</p>
                <p><strong>任务信息：</strong></p>
                <ul class="list-group mb-4">
                    <li class="list-group-item"><strong>名称：</strong>{{ task.name }}</li>
                    <li class="list-group-item"><strong>服务器：</strong>{{ task.server.name }}</li>
                    <li class="list-group-item"><strong>状态：</strong>
                        {% if task.status == 'running' %}
                            <span class="badge bg-warning">运行中</span>
                        {% elif task.status == 'completed' %}
                            <span class="badge bg-success">已完成</span>
                        {% elif task.status == 'failed' %}
                            <span class="badge bg-danger">已失败</span>
                        {% else %}
                            <span class="badge bg-secondary">{{ task.get_status_display }}</span>
                        {% endif %}
                    </li>
                    <li class="list-group-item"><strong>命令：</strong>{{ task.command|truncatechars:100 }}</li>
                </ul>
                <form method="post">
                    {% csrf_token %}
                    <div class="d-flex justify-content-between">
                        <button type="submit" class="btn btn-danger">
                            <i class="fas fa-trash me-1"></i>确认删除
                        </button>
                        <a href="{% url 'task_list' %}" class="btn btn-secondary">
                            <i class="fas fa-times me-1"></i>取消
                        </a>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
{% endblock %}
